<?php

namespace App\Http\Controllers;

use App\Models\Admin;
use App\Models\Basic;
use App\Models\Profit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redis;

class ProfitController extends AdminController
{


    /**
     * 显示页面
     */
    public function index(Request $request)
    {
        $where=array();
        if(!empty($request->year)){
            $where[]=array("year",$request->year);
        }
        if(!empty($request->month)){
            $where[]=array("month",$request->month);
        }


        $list = Profit::orderBy('id','desc')->where($where)->paginate(20);

        $append = array();
        $re = $request->toArray();
        foreach ($re as $key => $value) {
            $append[$key] = $value;
        }
        $list->appends($append);

        return view("profit.list",['data'=>$list]);

    }


}
